/*
Copyright 2007 Nathan Baker

This file is part of XAliens.

XAliens is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

XAliens is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with XAliens.  If not, see <http://www.gnu.org/licenses/>.
 */

package sprites;

import utils.BoundsRect;

import java.awt.*;

public class ShotEntity extends AnimatedEntity {

    /**
     * Creates a new ShotEntity with default velocity values (and not image).
     */
    @Deprecated
    public ShotEntity(BoundsRect rct) {
        mBounds = rct;
        mVelocityY = 0;
        mVelocityX = -1;
    }

    /**
     * Creates a new ShotEntity instance with an Image and a boundingBox for
     * restricting movement of the ShotEntity. Default velocity values are used if null.
     *
     * @param boundsRect A Rectangle representing the movement area allowed.
     * @param velocityX  VelocityX of the ShotEntity. Use null for default value.
     * @param velocityY  VelocityY of the ShotEntity. Use null for default value.
     */
    public ShotEntity(Rectangle boundsRect, Integer velocityX, Integer velocityY) {
        mBounds = (BoundsRect) boundsRect;

        mVelocityY = (velocityY == null) ? 0 : velocityY;
        mVelocityX = (velocityX == null) ? -1 : velocityX;
    }

    /**
     * Moves the ShotEntity using distanceX and distanceY. Note: move() does not
     * call draw().
     */
    public void move(int distanceX, int distanceY) {
        mImageX -= distanceX;
        mImageY -= distanceY;
    }

    /**
     * Moves the ShotEntity using what values are in velocityX and velocityY.
     * Note: move() does not call draw().
     */
    public void move() {
        mImageX -= mVelocityX;
        mImageY -= mVelocityY;
    }

    /**
     * Draws the ShotEntity.
     *
     * @param g The graphics context to draw to.
     */
    public void draw(Graphics2D g) {
        super.draw(g);
/*		try {
			super.draw(g);
		} catch (Exception e) {
			System.out.print("ShotEntity: " + e.getMessage() + "\n");
			System.out.print("ShotEntity: mImageX == "
					+ String.valueOf(mImageX) + "\n");
			System.out.print("ShotEntity: mImageY == "
					+ String.valueOf(mImageY) + "\n");
		}*/
    }
}
